package com.Smart.smartscals.Activity;

import com.Smart.smartscals.Entity.EntityRegist;
import com.Smart.smartscals.Entity.EntityUserInfo;
import com.Smart.smartscals.Fragment.BaseFragment;
import com.Smart.smartscals.Fragment.FragmentGudeAge;
import com.Smart.smartscals.Fragment.FragmentGudeHeight;
import com.Smart.smartscals.Fragment.FragmentGudeLogin;
import com.Smart.smartscals.Fragment.FragmentGudeName;
import com.Smart.smartscals.Fragment.FragmentGudeRegister;
import com.Smart.smartscals.Fragment.FragmentGudeSex;
import com.Smart.smartscals.Fragment.FragmentStartUsing;
import com.Smart.smartscals.Utils.Tools;

import android.app.Fragment;
import android.os.Bundle;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;

public class ActivityGuide extends BaseActivity {

	private FragmentGudeName mfragmentGudeName;
	private FragmentGudeSex mFragmentGudeSex;
	private FragmentGudeHeight mFragmentGudeHeight;
	private FragmentGudeAge mFragmentGudeAge;
	private FragmentGudeRegister mFragmentGudeRegister;

	private FragmentStartUsing mFragmentStartUsing;
	private FragmentGudeLogin mFragmentGudeLogin;
	

	private EntityRegist mEntityUserInfo;
	//用于确定返回是否可以点击；
	private boolean isBackClckable;

	


	public boolean isBackClckable() {
		return isBackClckable;
	}

	public void setBackClckable(boolean isBackClckable) {
		this.isBackClckable = isBackClckable;
	}


	public EntityRegist getmEntityUserInfo() {
		return mEntityUserInfo;
	}

	public void setmEntityUserInfo(EntityRegist mEntityUserInfo) {
		this.mEntityUserInfo = mEntityUserInfo;
	}

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activit_guide);

		inintParam();
		initFragment();
		Tools.startFragment(this, mFragmentStartUsing);

	}

	private void inintParam() {
		mfragmentManager = this.getSupportFragmentManager();
		mEntityUserInfo = new EntityRegist();
		isBackClckable = true;
	}

	private void initFragment() {
		mFragmentGudeAge = new FragmentGudeAge();
		mfragmentGudeName = new FragmentGudeName();
		mFragmentGudeSex = new FragmentGudeSex();
		mFragmentGudeHeight = new FragmentGudeHeight();
		mFragmentGudeAge = new FragmentGudeAge();
		mFragmentGudeRegister = new FragmentGudeRegister();
		mFragmentStartUsing = new FragmentStartUsing();
		mFragmentGudeLogin = new FragmentGudeLogin();
	}

	@Override
	public void onBackPressed() {
		// TODO Auto-generated method stub

		
		if (mFragmentTransaction.isAddToBackStackAllowed() && isBackClckable) {

			if (mfragmentGudeName.isAdded() || mFragmentGudeLogin.isAdded()) {

				// if (!baseFragmentLastTime.equals(mfragmentGudeName)) {
				super.onBackPressed();
				// }
			}

		}
	}
	


	public FragmentGudeLogin getmFragmentGudeLogin() {
		return mFragmentGudeLogin;
	}

	public void setmFragmentGudeLogin(FragmentGudeLogin mFragmentGudeLogin) {
		this.mFragmentGudeLogin = mFragmentGudeLogin;
	}

	public FragmentStartUsing getmFragmentStartUsing() {
		return mFragmentStartUsing;
	}

	public void setmFragmentStartUsing(FragmentStartUsing mFragmentStartUsing) {
		this.mFragmentStartUsing = mFragmentStartUsing;
	}

	public FragmentGudeRegister getmFragmentGudeRegister() {
		return mFragmentGudeRegister;
	}

	public void setmFragmentGudeRegister(
			FragmentGudeRegister mFragmentGudeRegister) {
		this.mFragmentGudeRegister = mFragmentGudeRegister;
	}

	public FragmentGudeName getMfragmentGudeName() {
		return mfragmentGudeName;
	}

	public void setMfragmentGudeName(FragmentGudeName mfragmentGudeName) {
		this.mfragmentGudeName = mfragmentGudeName;
	}

	public FragmentGudeHeight getmFragmentGudeHeight() {
		return mFragmentGudeHeight;
	}

	public void setmFragmentGudeHeight(FragmentGudeHeight mFragmentGudeHeight) {
		this.mFragmentGudeHeight = mFragmentGudeHeight;
	}

	private BaseFragment baseFragmentLastTime;// 本界面的Fragment;

	public FragmentGudeSex getmFragmentGudeSex() {
		return mFragmentGudeSex;
	}

	public BaseFragment getBaseFragmentLastTime() {
		return baseFragmentLastTime;
	}

	public void setBaseFragmentLastTime(BaseFragment baseFragmentLastTime) {
		this.baseFragmentLastTime = baseFragmentLastTime;
	}

	public void setmFragmentGudeSex(FragmentGudeSex mFragmentGudeSex) {
		this.mFragmentGudeSex = mFragmentGudeSex;
	}

	private FragmentManager mfragmentManager;
	private FragmentTransaction mFragmentTransaction;

	public FragmentManager getMfragmentManager() {
		return mfragmentManager;
	}

	public void setMfragmentManager(FragmentManager mfragmentManager) {
		this.mfragmentManager = mfragmentManager;
	}

	public FragmentTransaction getmFragmentTransaction() {
		return mFragmentTransaction;
	}

	public void setmFragmentTransaction(FragmentTransaction mFragmentTransaction) {
		this.mFragmentTransaction = mFragmentTransaction;
	}

	public FragmentGudeAge getmFragmentGudeAge() {
		return mFragmentGudeAge;
	}

	public void setmFragmentGudeAge(FragmentGudeAge mFragmentGudeAge) {
		this.mFragmentGudeAge = mFragmentGudeAge;
	}
}
